package org.example.controller;

import com.github.pagehelper.PageInfo;
import org.example.entity.FM;
import org.example.service.FMService;
import org.example.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName FMController
 * @Description TODO
 * @Author lipeijin
 * @Date 2025年08月14日 下午8:50
 * @Version 1.0
 */
@RestController
@RequestMapping("FM")
public class FMController {
    @Autowired
    private FMService fmService;
    @GetMapping
    public R getPage(@RequestParam(required = false,defaultValue = "1") int pageNum,
                     @RequestParam(required = false,defaultValue = "20") int PageSize){
        PageInfo<FM> pageInfo = fmService.getPage(pageNum, PageSize);
        return R.ok(pageInfo);
    }
    @GetMapping("tag")
    public R getPageMore(String tag,
                        @RequestParam(required = false,defaultValue = "1") int pageNum,
                        @RequestParam(required = false,defaultValue = "20") int PageSize){
        PageInfo<FM> pageInfo = fmService.getPageMore(tag,pageNum, PageSize);
        return R.ok(pageInfo);
    }
}
